import request from "../../utils/request.js"

/**
 * 业务拓扑列表查询(左侧菜单)
 * @returns 
 */
export const getToppologyList_Api = () => request.get("/configuration/search/list")
/**
 * 业务查询主机列表
 * @param {*} id //业务的exampleId
 * @returns 
 */
export const getToppologyListByExample_Api = (query) => request.get("/configuration/search/host", {
    params: query
})
/**
 * 集群查询主机列表
 * @param {*} id //集群id
 * @returns 
 */
export const getToppologyListByCluster_Api = (query) => request.get("/configuration/colony/host", {
    params: query
})


//集群模板
/**
 * 集群模版列表查询
 * @param {*} query ：{name,pageNum,PageSize}
 * @returns 
 */
export const getClusterList_Api = (query) => request.get("/configuration/colony/template/list", {
    params: query
})
/**
 * 集群模板添加
 * @param {*} data 
 * @returns 
 */
export const addCluster_Api = (data) => request.post("/configuration/colony/template", data)
/**
 * 集群模板编辑
 * @param {*} data 
 * @returns 
 */
export const editCluster_Api = (data) => request.put("/configuration/colony/template", data)
/**
 * 集群模板删除
 * @param {*} query  
 * @returns 
 */
export const delCluster_Api = (id) => request.delete("/configuration/colony/template/" + id)
/**
 * 集群模板详情查询
 * @param {*} query 
 * @returns 
 */
export const getClusterDetail_Api = (id) => request.get("/configuration/colony/template/" + id)
/**
 * 集群模板拓扑查询
 * @param {*} id 集群模板id
 * @returns 
 */
export const getClusterTopology_Api = (id) => request.get("/configuration/colony/template/topology/" + id)
/**
 * 添加集群模板和服务模板关联
 * @param {*} data 
 * @returns 
 */
export const addClusterTopology_Api = (data) => request.post("/configuration/colony/template/insert/topology", data)
/**
 * 删除集群模板和服务模板关联
 * @param {*} data 
 * @returns 
 */
export const delClusterTopology_Api = (data) => request.delete("/configuration/colony/template/remove/topology", { data })
/**
 * 根据集群模板id查询集群列表详情
 * @param {*} query 
 * @param {*} id 集群模板id
 * @returns 
 */
export const getClusterListById_Api = (query, id) => request.get("/configuration/colony/template/colonyInfo/" + id, {
    params: query
})
/**
 * 同步集群模板
 * @param {*} query 
 * @returns 
 */
export const syncClusterTemplate_Api = (id, data) => request.post("/configuration/colony/template/synchronize/" + id, data)



//服务模板
/**
 * 服务模版列表查询
 * @param {*} query 
 * @returns 
 */
export const serviceTemplateList_Api = (query) => request.get("/configuration/servlet/template/list", {
    params: query
})
/**
 * 服务模版新增
 * @param {} data 
 * @returns 
 */
export const addServiceTemplate_Api = (data) => request.post("/configuration/servlet/template", data)
/**
 * 服务模版编辑
 * @param {*} data 
 * @returns 
 */
export const editServiceTemplate_Api = (data) => request.put("/configuration/servlet/template", data)
/**
 * 服务模版删除
 * @param {*} id 
 * @returns 
 */
export const delServiceTemplate_Api = (id) => request.delete("/configuration/servlet/template/" + id)
/**
 * 根据服务模板id查询服务列表
 * @param {*} query
 * @returns 
 */
export const getListByServiceId_Api = (query) => request.get("/configuration/servlet/template/list/servlet", {
    params: query
})
/**
 * 服务模板同步
 * @param {*} data 
 * @returns 
 */
export const syncServiceTemplate_Api = (id) => request.post("/configuration/servlet/template/servlet/" + id)
/**
 * 根据服务模版id查询服务模板详情
 * @param {*} id 服务模版id
 * @returns 
 */
export const getServiceDetail_Api = (id) => request.get("/configuration/servlet/template/" + id)


//服务分类
/**
 * 服务分类列表查询
 * @param {*} query 
 * @returns 
 */
export const serviceCategoryList_Api = (query) => request.get("/configuration/servlet/category/list", {
    params: query
})
/**
 * 服务分类新增
 * @param {*} query 
 * @returns 
 */
export const addServiceCategory_Api = (data) => request.post("/configuration/servlet/category", data)
/**
 * 服务分类编辑
 * @param {*} data 
 * @returns 
 */
export const editServiceCategory_Api = (data) => request.put("/configuration/servlet/category", data)
/**
 * 服务分类删除
 * @param {*} id 要删除的服务id
 * @returns 
 */
export const delServiceCategory_Api = (id) => request.delete("/configuration/servlet/category/" + id, {
    params: { categoryId: id }
})
/**
 * 根据父级列id查询子集列表
 * @param {*} id parentId
 * @returns 
 */
export const getChildList_Api = (id) => request.get("/configuration/servlet/" + id)



//进程管理
/**
 * 根据主机id查询进程列表
 * @param {*} query 
 * @param {*} exampleId 
 * @returns 
 */
export const getProcessListByHostId_Api = (query, id) => request.get("/configuration/process/list/by/" + id, {
    params: query
})
/**
 * 根据服务模板id查询进程列表
 * @param {*} query 
 * @param {*} exampleId 
 * @returns 
 */
export const getProcessListByServiceId_Api = (query, id) => request.get("/configuration/process/list/" + id, {
    params: query
})
/**
 * 添加进程
 * @param {*} data 
 * @returns 
 */
export const addProcess_Api = (data) => request.post("/configuration/process", data)
/**
 * 编辑进程
 * @param {*} data 
 * @returns 
 */
export const editProcess_Api = (data) => request.put("/configuration/process", data)
/**
 * 删除进程
 * @param {*} id 
 * @returns 
 */
export const delProcess_Api = (id) => request.delete("/configuration/process/" + id)



//集群管理
/**
 * 集群新增
 * @param {*} data 
 * @returns 
 */
export const addColony_Api = (data) => request.post("/configuration/colony", data)
/**
 * 集群编辑
 * @param {*} data 
 * @returns 
 */
export const editColony_Api = (data) => request.put("/configuration/colony", data)
/**
 * 集群删除
 * @param {*} id 集群id
 * @returns 
 */
export const delColony_Api = (id) => request.delete("/configuration/colony/" + id)
/**
 * 获取集群下服务列表
 * @param {*} id 集群id
 * @returns 
 */
export const getServicecListByColonyId_Api = (id) => request.get("/configuration/colony/" + id)



//服务管理
/**
 * 根据服务id获取主机实例列表
 * @param {*} id 服务id
 * @returns 
 */
export const getHostListByServiceId_Api = (query) => request.get("/configuration/servlet/host", {
    params: query
})
/**
 * 根据服务id获取节点信息
 * @param {*} id 服务id
 * @returns 
 */
export const getNodeByServiceId_Api = (id) => request.get("/configuration/servlet/" + id)
/**
 * 服务新增
 * @param {*} data 
 * @returns 
 */
export const addService_Api = (data) => request.post("/configuration/servlet", data)
/**
 * 服务编辑
 * @param {*} data 
 * @returns 
 */
export const editService_Api = (data) => request.put("/configuration/servlet", data)
/**
 * 服务删除
 * @param {*} id 服务id
 * @returns 
 */
export const delService_Api = (id) => request.delete("/configuration/servlet/" + id)